# ~*~ coding: utf-8 ~*~
from flask_wtf import FlaskForm
from wtforms import StringField
from wtforms.validators import InputRequired

from apps.common.form import ErrorFormMinx

__all__ = ['IntervalForm']


class IntervalForm(ErrorFormMinx, FlaskForm):
    every = StringField(validators=[InputRequired(message="时间不能为空")])
    period = StringField(validators=[InputRequired(message="单位不能为空")])

    @property
    def data(self):
        return {
            'every': self.every.data,
            'period': self.period.data,
        }
